<?php
/**
 * @author bbernath
 *         Date: 09.10.13
 *         Time: 11:21
 * @version 1.0.2
 */
?>

<h3>&raquo; Preisliste</h3>

Hier ein kleiner Auszug aus unserer Preisliste. <br>Alle Angaben verstehen sich ohne Gew&auml;hr.<br><br>

<table border="1" id="pricelist">
    <tr>
        <td colspan="2"><b>Herren:</b></td>
    </tr>

    <?php
    $sql = "select name, price, static_price from pricelist where pricelist_category = ?";
    $stmt = $db->prepare($sql);
    $pricelist_category_id = 1;
    $stmt->bind_param('i', $pricelist_category_id);
    $stmt->execute();
    $stmt->bind_result($name, $price, $static_price);
    $pricelist = array();
    while ($stmt->fetch()) {
        $pricelist[] = array(
            'name' => $name,
            'price' => $price,
            'static_price' => $static_price
        );
    }
    $stmt->close();
    ?>
    <?php
    foreach ($pricelist as $price_entry) {
        echo "<tr><td width='400'>" . $price_entry['name'] . "</td>";
        if ($price_entry['static_price'] == "T") {
            echo "<td>" . number_format($price_entry['price'], 2, ",", ".") . " EUR</td></tr>";
        } else {
            echo "<td>ab " . number_format($price_entry['price'], 2, ",", ".") . " EUR</td></tr>";
        }
    }?>

    <tr>
        <td colspan="2"><br></td>
    </tr>
    <tr>
        <td colspan="2"><b>Damen:</b></td>
    </tr>

    <?php
    $sql = "select name, price, static_price from pricelist where pricelist_category = ?";
    $stmt = $db->prepare($sql);
    $pricelist_category_id = 2;
    $stmt->bind_param('i', $pricelist_category_id);
    $stmt->execute();
    $stmt->bind_result($name, $price, $static_price);
    $pricelist = array();
    while ($stmt->fetch()) {
        $pricelist[] = array(
            'name' => $name,
            'price' => $price,
            'static_price' => $static_price
        );
    }
    $stmt->close();
    ?>
    <?php
    foreach ($pricelist as $price_entry) {
        echo "<tr><td width='400'>" . $price_entry['name'] . "</td>";
        if ($price_entry['static_price'] == "T") {
            echo "<td>" . number_format($price_entry['price'], 2, ",", ".") . " EUR</td></tr>";
        } else {
            echo "<td>ab " . number_format($price_entry['price'], 2, ",", ".") . " EUR</td></tr>";
        }
    }?>

    <tr>
        <td colspan="2"><br></td>
    </tr>
    <tr>
        <td colspan="2"><b>Frisuren:</b></td>
    </tr>

    <?php
    $sql = "select name, price, static_price from pricelist where pricelist_category = ?";
    $stmt = $db->prepare($sql);
    $pricelist_category_id = 3;
    $stmt->bind_param('i', $pricelist_category_id);
    $stmt->execute();
    $stmt->bind_result($name, $price, $static_price);
    $pricelist = array();
    while ($stmt->fetch()) {
        $pricelist[] = array(
            'name' => $name,
            'price' => $price,
            'static_price' => $static_price
        );
    }
    $stmt->close();
    ?>
    <?php
    foreach ($pricelist as $price_entry) {
        echo "<tr><td width='400'>" . $price_entry['name'] . "</td>";
        if ($price_entry['static_price'] == "T") {
            echo "<td>" . number_format($price_entry['price'], 2, ",", ".") . " EUR</td></tr>";
        } else {
            echo "<td>ab " . number_format($price_entry['price'], 2, ",", ".") . " EUR</td></tr>";
        }
    }?>
</table>